/** <!--------------------------------------------------------------------------------------------->
 * @file SvnHistoryListener.h
 *
 * GSvn - A Graphical Client for SVN
 * Copyright (C) 2012  Karl Krach, gsvn@bluespirit.la
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 <!---------------------------------------------------------------------------------------------> */

#ifndef SVN_HISTORY_LISTENER_H
#define SVN_HISTORY_LISTENER_H

// -- includes --
#include <QString>
#include <QSharedPointer>
#include <QDateTime>
#include <QStringList>

// --- forward declarations ---
// --- namespaces ---
// --- defines ---
#ifndef QSP
#define QSP QSharedPointer
#endif


/** <!--------------------------------------------------------------------------------------------->
 * History listener interface to be implemented as call back for the history methods.
 *
 * @author	Karl Krach, <gsvn@bluespirit.la>
 * @since	2012-01-08
 <!---------------------------------------------------------------------------------------------> */
class SvnHistoryListener
{

	/* Inner Classes */
public:

	struct SvnCopyInfo
	{
		SvnCopyInfo( QString strFromPath, int iFromRev ) : m_strFromPath( strFromPath ), m_iFromRev( iFromRev ) {}
		QString m_strFromPath;
		int     m_iFromRev;
	};

	/* Methods */
public:
	/** <!----------------------------------------------------------------------------------------->
	 * Callback method to be called on each history element (triggered by 'svn log')
	 *
	 * @param iRevision     (in) SVN revision
	 * @param oDateTime     (in) SVN commit time
	 * @param strMessage    (in) SVN log message
	 * @param strAuthor     (in) SVN author
	 * @param aChangedFiles (in) changed files in this revision
	 * @param pCopyInfo     (in) SVN copy info (branch info)
	 <!-----------------------------------------------------------------------------------------> */
	virtual void OnHistoryReceive( int iRevision, QDateTime oDateTime, QString strMessage,
	                               QString strAuthor, QStringList aChangedFiles,
	                               QList<SvnCopyInfo> aCopyInfo ) = 0;

	/** <!----------------------------------------------------------------------------------------->
	 * Callback method to be called on every progress-update
	 *
	 * @param fBytesReceived (in) Received bytes
	 * @param fThrougput     (in) Throughput in kB/sec
	 <!-----------------------------------------------------------------------------------------> */
	virtual void OnHistoryProgress( float fBytesReceived, float fThrouput ) = 0;

	/** <!----------------------------------------------------------------------------------------->
	 * Callback method to be called on every statistic update
	 *
	 * @param strCommand (in) Name of last command
	 * @param iMsNeeded  (in) Milliseconds need for the last command
	 * @param fBytesReceived (in) Received bytes
	 <!-----------------------------------------------------------------------------------------> */
	virtual void OnHistoryStatistics( QString strCommand, int iMsNeeded, float fBytesReceived ) = 0;

};	// END interface SvnHistoryListener

#endif // SVN_HISTORY_LISTENER_H
